<!DOCTYPE html>
<html lang="zh">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
<meta name="keywords" content="LightYear,LightYearAdmin,光年,后台模板,后台管理系统,光年HTML模板">
<meta name="description" content="Light Year Admin V5是一个基于Bootstrap v5.1.3的后台管理系统的HTML模板。">
<title>模态框 - 光年(Light Year Admin V5)后台管理系统模板</title>
<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">
<link rel="stylesheet" type="text/css" href="css/materialdesignicons.min.css">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/style.min.css">
</head>
  
<body>
<div class="container-fluid">
  
  <div class="row">
    
    <div class="col-lg-12">
      <div class="card">
        <header class="card-header"><div class="card-title">模态框</div></header>
        <div class="card-body">
          
          <p>使用 Bootstrap 的 JavaScript 模态插件向您的站点添加对话框，用于灯箱、用户通知或完全自定义的内容。</p>
          
          <h5>它是怎样工作的</h5>
          <p>在开始使用 Bootstrap 的模态组件之前，请务必阅读以下内容，因为我们的菜单选项最近发生了变化。</p>
          <ul>
            <li>模态框是用 HTML、CSS 和 JavaScript 构建的。 它们被定位在文档中的所有其他内容之上，并从 <code>&lt;body&gt;</code> 中移除滚动，以便模态框内容滚动。</li>
            <li>点击模态 “背景” 将自动关闭模态框。</li>
            <li>Bootstrap 一次只支持一个模态窗口。不支持嵌套模式，因为我们认为它们是糟糕的用户体验。</li>
            <li>模态框使用 <code>position:fixed</code>，它的渲染有时会有些特殊。只要有可能，将您的模态 HTML 放在顶级位置，以避免来自其他元素的潜在干扰。 将 <code>.modal</code> 嵌套在另一个固定元素中时，您可能会遇到问题。</li>
            <li>再一次，由于 <code>position:fixed</code>，在移动设备上使用模态框有一些注意事项。</li>
            <li>由于 HTML5 如何定义其语义，<a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-autofocus" target="_blank"><code>autofocus</code > HTML 属性</a> 在 Bootstrap 模式中无效。要达到相同的效果，请使用一些自定义 JavaScript：</li>
          </ul>
          <pre>var myModal = document.getElementById('myModal')
var myInput = document.getElementById('myInput')

myModal.addEventListener('shown.bs.modal', function () {
  myInput.focus()
})</pre>
          <div class="callout callout-info mb-3">该组件的动画效果依赖于 <code>prefers-reduced-motion</code> 媒体查询。</div>

          <p>继续阅读演示和使用指南。</p>
          <h5>示例</h5>
          <h6>模态组件</h6>
          <p>下面是一个 <em>static</em> 模态示例（意味着它的 <code>position</code> 和 <code>display</code> 已被覆盖）。 包括模态标题、模态正文（<code>padding</code> 必需）和模态页脚（可选）。 我们要求您尽可能在模式标题中包含解除操作，或提供另一个明确的解除操作。</p>
          <div class="border-example border-example-modal">
            <div class="modal" tabindex="-1">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <h6 class="modal-title">标题</h6>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                  </div>
                  <div class="modal-body">
                    <p>祷罢，试卜一爻，暗视道：“我李靖若有天子之分，乞即赐一圣爻。”将爻掷下。</p>
                  </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">保存修改</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <pre>&lt;div class="modal" tabindex="-1"&gt;
  &lt;div class="modal-dialog"&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;h6 class="modal-title"&gt;标题&lt;/h6&gt;
        &lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
        &lt;p&gt;祷罢，试卜一爻，暗视道：“我李靖若有天子之分，乞即赐一圣爻。”将爻掷下。&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;button type="button" class="btn btn-secondary" data-bs-dismiss="modal"&gt;关闭&lt;/button&gt;
        &lt;button type="button" class="btn btn-primary"&gt;保存修改&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;</pre>
          
          <h6>现场示例</h6>
          <p>通过单击下面的按钮来切换工作模式演示。它将向下滑动并从页面顶部淡入。</p>
          <div class="modal fade" id="exampleModalLive" tabindex="-1" aria-labelledby="exampleModalLiveLabel" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalLiveLabel">二心集</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <p>杂文集，收录了鲁迅在1930年-1931年间所写的杂文三十七篇。</p>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">保存修改</button>
                </div>
              </div>
            </div>
          </div>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalLive">
              启动演示模态框
            </button>
          </div>
          <pre>&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalLive"&gt;
  启动演示模态框
&lt;/button&gt;

&lt;div class="modal fade" id="exampleModalLive" tabindex="-1" aria-labelledby="exampleModalLiveLabel" aria-hidden="true"&gt;
  &lt;div class="modal-dialog"&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;h6 class="modal-title" id="exampleModalLiveLabel"&gt;二心集&lt;/h6&gt;
        &lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
        &lt;p&gt;杂文集，收录了鲁迅在1930年-1931年间所写的杂文三十七篇。&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;button type="button" class="btn btn-secondary" data-bs-dismiss="modal"&gt;关闭&lt;/button&gt;
        &lt;button type="button" class="btn btn-primary"&gt;保存修改&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;</pre>
          <h6>静态背景</h6>
          <p>当背景设置为静态时，在其外部单击时模态将不会关闭。单击下面的按钮进行尝试。</p>
          <div class="modal fade" id="staticBackdropLive" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="staticBackdropLiveLabel">东游记</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <p>又名《上洞八仙传》、《八仙出处东游记》，共二卷五十六回。记叙铁拐李、汉钟离、吕洞宾、张果老、蓝采和、何仙姑、韩湘子、曹国舅八位神仙修炼得道的过程。</p>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">明白了</button>
                </div>
              </div>
            </div>
          </div>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdropLive">
              启动静态背景模态框
            </button>
          </div>
          <pre>&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdropLive"&gt;
  启动静态背景模态框
&lt;/button&gt;

&lt;div class="modal fade" id="staticBackdropLive" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLiveLabel" aria-hidden="true"&gt;
  &lt;div class="modal-dialog"&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;h6 class="modal-title" id="staticBackdropLiveLabel"&gt;东游记&lt;/h6&gt;
        &lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
        &lt;p&gt;又名《上洞八仙传》、《八仙出处东游记》，共二卷五十六回。记叙铁拐李、汉钟离、吕洞宾、张果老、蓝采和、何仙姑、韩湘子、曹国舅八位神仙修炼得道的过程。&lt;/p&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;button type="button" class="btn btn-secondary" data-bs-dismiss="modal"&gt;关闭&lt;/button&gt;
        &lt;button type="button" class="btn btn-primary"&gt;明白了&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;</pre>
          <h6>滚动长内容</h6>
          <p>当模态框对于用户的视口或设备而言变得太长时，它们会独立于页面本身滚动。试试下面的演示，看看我们的意思。</p>
          <div class="modal fade" id="exampleModalLong" tabindex="-1" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalLongTitle">乐府古题要解</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body" style="min-height: 1500px">
                  <p>音乐著作。分上下二卷。采录史传与诸家文集有关乐府古题命名缘起的记载纂辑成书材料丰富考证翔实。对研究汉魏六朝音乐有一定的参考价值。但卷末附载“建除体”及“字谜”等都与乐府无关。有明毛晋汲古阁据元刻所刊《学津讨原》本。《乐府古题要解》书前有小序，说明了作者撰述此书的目的，是要扫除乐府诗创作中“不睹于本章，便断题取义”的积弊，为后人“取正”提供依据。书中罗列汉魏六朝乐府古题一百余个，分别阐发其最初的主旨、涵义，有的还引录古词，考证本事，叙述流变，内容较为详实。</p>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">保存修改</button>
                </div>
              </div>
            </div>
          </div>
          <div class="border-example mb-3">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalLong">
              启动演示模态框
            </button>
          </div>
          
          <p>您还可以通过将 <code>.modal-dialog-scrollable</code> 添加到 <code>.modal-dialog</code> 来创建允许滚动模态体的可滚动模态。</p>
          <div class="modal fade" id="exampleModalScrollable" tabindex="-1" aria-labelledby="exampleModalScrollableTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-scrollable">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalScrollableTitle">二十四尊得道罗汉传</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <p>《二十四尊得道罗汉传》是明代朱星祚编写的一部书籍，万历间刊本，日本内阁文库藏。孙楷第《中国通俗小说书目》、《日本东京所见小说书目》均有著录。谭正壁等著《古本稀见小说汇考》第五十六条《二十四尊得道罗汉传》所述,则系综合翻录孙楷第所著书目中文。《罗汉传》是一部稀见小说。</p>
                  <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
                  <p>滚动后，此内容应显示在底部。</p>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">保存修改</button>
                </div>
              </div>
            </div>
          </div>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalScrollable">
              启动演示模态框
            </button>
          </div>
          <pre>&lt;!-- 可滚动模态框 --&gt;
&lt;div class="modal-dialog modal-dialog-scrollable"&gt;
  ...
&lt;/div&gt;</pre>
          
          <h6>垂直居中</h6>
          <p>将 <code>.modal-dialog-centered</code> 添加到 <code>.modal-dialog</code> 以使模态框垂直居中。</p>
          <div class="modal fade" id="exampleModalCenter" tabindex="-1" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalCenterTitle">于公案</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <p>评书传统书目，长篇，编创于清末。石玉昆纂弄的《三侠五义》（《包公案》）问世以后，北京一些有编创能力的评书艺人纷起效仿，纂弄新书，《于公案》就是其中影响较大的一种。</p>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">保存修改</button>
                </div>
              </div>
            </div>
          </div>
          <div class="modal fade" id="exampleModalCenteredScrollable" tabindex="-1" aria-labelledby="exampleModalCenteredScrollableTitle" aria-hidden="true">
            <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalCenteredScrollableTitle">五代秘史</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <p>五代日事干戈，胡虏交驰，乱贼横行，中原始无宁宇，幸宋太祖一统中华，其亦世道之幸欤！一段不为人知的历史！</p>
                  <br><br><br><br><br><br><br><br><br><br><br><br><br><br>
                  <p>就这样。</p>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">保存修改</button>
                </div>
              </div>
            </div>
          </div>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalCenter">
              垂直居中的模态框
            </button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalCenteredScrollable">
              垂直居中的可滚动模态框
            </button>
          </div>
          <pre>&lt;!-- 垂直居中的模态框 --&gt;
&lt;div class="modal-dialog modal-dialog-centered"&gt;
  ...
&lt;/div&gt;

&lt;!-- 垂直居中的可滚动模态框 --&gt;
&lt;div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"&gt;
  ...
&lt;/div&gt;</pre>
          
          <h6>工具提示和弹出框</h6>
          <p>工具提示和弹出框可以根据需要放置在模态框中。当模态框关闭时，其中的任何工具提示和弹出框也会自动关闭。</p>
          <div class="modal fade" id="exampleModalPopovers" tabindex="-1" aria-labelledby="exampleModalPopoversLabel" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalPopoversLabel">五虎征西</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <h5>模态框中的Popover</h5>
                  <p>与 <a href="#" role="button" class="btn btn-secondary" title="万花楼演义" data-bs-content="又名《万花楼杨包狄演义》，十四卷六十八回。" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right">《万花楼演义》</a> 同脉络，但情节内容自成首尾，叙述宋仁宗命狄青等五虎将征西的故事。</p>
                  <hr>
                  <h5>模态框中的Tooltips</h5>
                  <p>作者依照时代的人心需要，创造了<a href="#" title="字汉臣，北宋名将" data-bs-container="#exampleModalPopovers" data-bs-toggle="tooltip" data-bs-placement="top">狄青</a> 和 <a href="#" title="字希仁，北宋名臣" data-bs-container="#exampleModalPopovers" data-bs-toggle="tooltip" data-bs-placement="top">包公</a> 等符合人们愿望的人物，托名历史而演述出一系列故事。</p>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">保存修改</button>
                </div>
              </div>
            </div>
          </div>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalPopovers">
              启动演示模态框
            </button>
          </div>
          <pre>&lt;div class="modal-body"&gt;
  &lt;h5&gt;模态框中的Popover&lt;/h5&gt;
  &lt;p&gt;与&lt;a href="#" role="button" class="btn btn-secondary" title="万花楼演义" data-bs-content="又名《万花楼杨包狄演义》，十四卷六十八回。" data-bs-container="body" data-bs-toggle="popover" data-bs-placement="right"&gt;《万花楼演义》&lt;/a&gt;同脉络，但情节内容自成首尾，叙述宋仁宗命狄青等五虎将征西的故事。&lt;/p&gt;
  &lt;hr&gt;
  &lt;h5&gt;模态框中的Tooltips&lt;/h5&gt;
  &lt;p&gt;作者依照时代的人心需要，创造了&lt;a href="#" title="字汉臣，北宋名将" data-bs-container="#exampleModalPopovers" data-bs-toggle="tooltip" data-bs-placement="top"&gt;狄青&lt;/a&gt;和&lt;a href="#" title="字希仁，北宋名臣" data-bs-container="#exampleModalPopovers" data-bs-toggle="tooltip" data-bs-placement="top"&gt;包公&lt;/a&gt;等符合人们愿望的人物，托名历史而演述出一系列故事。&lt;/p&gt;
&lt;/div&gt;</pre>
          
          <h6>使用网格</h6>
          <p>通过将 <code>.container-fluid</code> 嵌套在 <code>.modal-body</code> 中，在 modal 中使用 Bootstrap 网格系统。然后，像在其他任何地方一样使用普通的网格系统类。</p>
          <div class="modal fade" id="gridSystemModal" tabindex="-1" aria-labelledby="gridModalLabel" aria-hidden="true">
            <div class="modal-dialog">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="gridModalLabel">模态框中的网格</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  <div class="container-fluid bd-example-row">
                    <div class="row">
                      <div class="col-md-4">.col-md-4</div>
                      <div class="col-md-4 ms-auto">.col-md-4 .ms-auto</div>
                    </div>
                    <div class="row">
                      <div class="col-md-3 ms-auto">.col-md-3 .ms-auto</div>
                      <div class="col-md-2 ms-auto">.col-md-2 .ms-auto</div>
                    </div>
                    <div class="row">
                      <div class="col-md-6 ms-auto">.col-md-6 .ms-auto</div>
                    </div>
                    <div class="row">
                      <div class="col-sm-9">
                        Level 1: .col-sm-9
                        <div class="row">
                          <div class="col-8 col-sm-6">
                            Level 2: .col-8 .col-sm-6
                          </div>
                          <div class="col-4 col-sm-6">
                            Level 2: .col-4 .col-sm-6
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                  <button type="button" class="btn btn-primary">保存修改</button>
                </div>
              </div>
            </div>
          </div>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#gridSystemModal">
              启动演示模态框
            </button>
          </div>
          <pre>&lt;div class="modal-body"&gt;
  &lt;div class="container-fluid bd-example-row"&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-md-4"&gt;.col-md-4&lt;/div&gt;
      &lt;div class="col-md-4 ms-auto"&gt;.col-md-4 .ms-auto&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-md-3 ms-auto"&gt;.col-md-3 .ms-auto&lt;/div&gt;
      &lt;div class="col-md-2 ms-auto"&gt;.col-md-2 .ms-auto&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-md-6 ms-auto"&gt;.col-md-6 .ms-auto&lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="row"&gt;
      &lt;div class="col-sm-9"&gt;
        Level 1: .col-sm-9
        &lt;div class="row"&gt;
          &lt;div class="col-8 col-sm-6"&gt;
            Level 2: .col-8 .col-sm-6
          &lt;/div&gt;
          &lt;div class="col-4 col-sm-6"&gt;
            Level 2: .col-4 .col-sm-6
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;</pre>
          
          <h6>改变模态框内容</h6>
          <p>有一堆按钮都触发相同的模式，内容略有不同？使用 <code>event.relatedTarget</code> 和 <a href="https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes" target="_blank">HTML <code >data-bs-*</code> 属性</a> 以根据单击的按钮来改变模式的内容。</p>
          <p>下面是一个现场演示，后面是示例 HTML 和 JavaScript。如需更多信息，请阅读模态事框件文档以了解有关 <code>relatedTarget</code> 的详细信息。</p>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@mdo">打开模态 @mdo</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@fat">打开模态框 @fat</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@getbootstrap">打开模态框 @getbootstrap</button>
            
            <div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
              <div class="modal-dialog">
                <div class="modal-content">
                  <div class="modal-header">
                    <h6 class="modal-title" id="exampleModalLabel">新消息</h6>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                  </div>
                  <div class="modal-body">
                    <form>
                      <div class="mb-3">
                        <label for="recipient-name" class="col-form-label">收件人：</label>
                        <input type="text" class="form-control" id="recipient-name">
                      </div>
                      <div class="mb-3">
                        <label for="message-text" class="col-form-label">消息：</label>
                        <textarea class="form-control" id="message-text"></textarea>
                      </div>
                    </form>
                  </div>
                  <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                    <button type="button" class="btn btn-primary">发送消息</button>
                  </div>
                </div>
              </div>
            </div>
          </div>
          <pre>&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@mdo"&gt;打开模态 @mdo&lt;/button&gt;
&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@fat"&gt;打开模态框 @fat&lt;/button&gt;
&lt;button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModal" data-bs-whatever="@getbootstrap"&gt;打开模态框 @getbootstrap&lt;/button&gt;

&lt;div class="modal fade" id="exampleModal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"&gt;
  &lt;div class="modal-dialog"&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;h6 class="modal-title" id="exampleModalLabel"&gt;新消息&lt;/h6&gt;
        &lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
        &lt;form&gt;
          &lt;div class="mb-3"&gt;
            &lt;label for="recipient-name" class="col-form-label"&gt;收件人：&lt;/label&gt;
            &lt;input type="text" class="form-control" id="recipient-name"&gt;
          &lt;/div&gt;
          &lt;div class="mb-3"&gt;
            &lt;label for="message-text" class="col-form-label"&gt;消息：&lt;/label&gt;
            &lt;textarea class="form-control" id="message-text"&gt;&lt;/textarea&gt;
          &lt;/div&gt;
        &lt;/form&gt;
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;button type="button" class="btn btn-secondary" data-bs-dismiss="modal"&gt;关闭&lt;/button&gt;
        &lt;button type="button" class="btn btn-primary"&gt;发送消息&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;</pre>
          <pre>var exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', function (event) {
  // Button that triggered the modal
  var button = event.relatedTarget
  // Extract info from data-bs-* attributes
  var recipient = button.getAttribute('data-bs-whatever')
  // If necessary, you could initiate an AJAX request here
  // and then do the updating in a callback.
  //
  // Update the modal's content.
  var modalTitle = exampleModal.querySelector('.modal-title')
  var modalBodyInput = exampleModal.querySelector('.modal-body input')

  modalTitle.textContent = '给 ' + recipient + '的新消息'
  modalBodyInput.value = recipient
})</pre>
          
          <h6>在模态框之间切换</h6>
          <p>通过巧妙地放置 <code>data-bs-target</code> 和 <code>data-bs-toggle</code> 属性在多个模式之间切换。例如，您可以在已打开的登录模式中切换密码重置模式。<strong>请注意，不能同时打开多个模态框</strong>——此方法只是在两个单独的模态框之间切换。</p>
          <div class="bd-example">
            <div class="modal fade" id="exampleModalToggle" aria-hidden="true" aria-labelledby="exampleModalToggleLabel" tabindex="-1">
              <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                  <div class="modal-header">
                    <h6 class="modal-title" id="exampleModalToggleLabel">模态框 1</h6>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                  </div>
                  <div class="modal-body">
                    显示第二个模态并使用下面的按钮隐藏这个。
                  </div>
                  <div class="modal-footer">
                    <button class="btn btn-primary" data-bs-target="#exampleModalToggle2" data-bs-toggle="modal">打开第二个模态框</button>
                  </div>
                </div>
              </div>
            </div>
            <div class="modal fade" id="exampleModalToggle2" aria-hidden="true" aria-labelledby="exampleModalToggleLabel2" tabindex="-1">
              <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                  <div class="modal-header">
                    <h6 class="modal-title" id="exampleModalToggleLabel2">模态框 2</h6>
                    <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                  </div>
                  <div class="modal-body">
                    隐藏此模式并使用下面的按钮显示第一个。
                  </div>
                  <div class="modal-footer">
                    <button class="btn btn-primary" data-bs-target="#exampleModalToggle" data-bs-toggle="modal">返回第一个模态框</button>
                  </div>
                </div>
              </div>
            </div>
            <a class="btn btn-primary" data-bs-toggle="modal" href="#exampleModalToggle" role="button">打开第一个模态框</a>
          </div>
          <pre>&lt;div class="modal fade" id="exampleModalToggle" aria-hidden="true" aria-labelledby="exampleModalToggleLabel" tabindex="-1"&gt;
  &lt;div class="modal-dialog modal-dialog-centered"&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;h6 class="modal-title" id="exampleModalToggleLabel"&gt;模态框 1&lt;/h6&gt;
        &lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
        显示第二个模态并使用下面的按钮隐藏这个。
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;button class="btn btn-primary" data-bs-target="#exampleModalToggle2" data-bs-toggle="modal"&gt;打开第二个模态框&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div class="modal fade" id="exampleModalToggle2" aria-hidden="true" aria-labelledby="exampleModalToggleLabel2" tabindex="-1"&gt;
  &lt;div class="modal-dialog modal-dialog-centered"&gt;
    &lt;div class="modal-content"&gt;
      &lt;div class="modal-header"&gt;
        &lt;h6 class="modal-title" id="exampleModalToggleLabel2"&gt;模态框 2&lt;/h6&gt;
        &lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;
      &lt;/div&gt;
      &lt;div class="modal-body"&gt;
        隐藏此模式并使用下面的按钮显示第一个。
      &lt;/div&gt;
      &lt;div class="modal-footer"&gt;
        &lt;button class="btn btn-primary" data-bs-target="#exampleModalToggle" data-bs-toggle="modal"&gt;返回第一个模态框&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;a class="btn btn-primary" data-bs-toggle="modal" href="#exampleModalToggle" role="button"&gt;打开第一个模态框&lt;/a&gt;</pre>
          
          <h6>更改动画</h6>
          <p><code>$modal-fade-transform</code> 变量决定了 <code>.modal-dialog</code> 在模态淡入动画之前的变换状态，<code>$modal-show-transform</code> 变量决定了 <code>.modal-dialog</code> 在模态淡入动画结束时的变换。</p>
          <p>例如，如果你想要一个放大动画，你可以设置 <code>$modal-fade-transform: scale(.8)</code>。</p>
          
          <h6>移除动画</h6>
          <p>对于只是出现而不是淡入查看的模态，请从模态标记中删除 <code>.fade</code> 类。</p>
          <pre>&lt;div class="modal" tabindex="-1" aria-labelledby="..." aria-hidden="true"&gt;
  ...
&lt;/div&gt;</pre>
          
          <h6>动态高度</h6>
          <p>如果模态框在打开时高度发生变化，您应该调用 <code>myModal.handle Update()</code> 来调整模态框的位置，以防出现滚动条。</p>
          <h6>可访问性</h6>
          <p>请务必将引用模态标题的 <code>aria-labelledby="..."</code> 添加到 <code>.modal</code>。 此外，您可以在 <code>.modal</code> 上使用 <code>aria- describeby</code> 来描述您的模态对话框。 请注意，您不需要添加 <code>role="dialog"</code>，因为我们已经通过 JavaScript 添加了它。</p>
          <h6>嵌入 YouTube 视频</h6>
          <p>在模态中嵌入 YouTube 视频需要额外的 JavaScript，而不是 Bootstrap 来自动停止播放等等。 <a href="https://stackoverflow.com/questions/18622508/bootstrap-3-and-youtube-in-modal" target="_blank">查看这篇有用的 Stack Overflow 帖子</a>了解更多信息。</p>
          <h5>可选尺寸</h5>
          <p>模态框有三种可选尺寸，可通过修饰符类放置在 <code>.modal-dialog</code> 上。 这些尺寸在某些断点处开始，以避免在较窄的视口上出现水平滚动条。</p>
          <table class="table">
            <thead>
              <tr>
                <th>尺寸</th>
                <th>Class</th>
                <th>模态框最大宽度</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td>小</td>
                <td><code>.modal-sm</code></td>
                <td><code>300px</code></td>
              </tr>
              <tr>
                <td>默认</td>
                <td class="text-muted">None</td>
                <td><code>500px</code></td>
              </tr>
              <tr>
                <td>大</td>
                <td><code>.modal-lg</code></td>
                <td><code>800px</code></td>
              </tr>
              <tr>
                <td>特大</td>
                <td><code>.modal-xl</code></td>
                <td><code>1140px</code></td>
              </tr>
            </tbody>
          </table>
          <p>我们没有修饰符类的默认模态构成了 &ldquo;medium&rdquo; 大小模态。</p>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalXl">超大模态框</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalLg">大模态框</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalSm">小模态框</button>
          </div>
          <div class="modal fade" id="exampleModalXl" tabindex="-1" aria-labelledby="exampleModalXlLabel" aria-hidden="true">
            <div class="modal-dialog modal-xl">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalXlLabel">超大模态框</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
              </div>
            </div>
          </div>
          <div class="modal fade" id="exampleModalLg" tabindex="-1" aria-labelledby="exampleModalLgLabel" aria-hidden="true">
            <div class="modal-dialog modal-lg">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalLgLabel">大模态框</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
              </div>
            </div>
          </div>
          <div class="modal fade" id="exampleModalSm" tabindex="-1" aria-labelledby="exampleModalSmLabel" aria-hidden="true">
            <div class="modal-dialog modal-sm">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalSmLabel">小模态框</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
              </div>
            </div>
          </div>
          <pre>&lt;div class="modal-dialog modal-xl"&gt;...&lt;/div&gt;
&lt;div class="modal-dialog modal-lg"&gt;...&lt;/div&gt;
&lt;div class="modal-dialog modal-sm"&gt;...&lt;/div&gt;</pre>
          
          <h5>全屏模式</h5>
          <p>另一个覆盖是弹出覆盖用户视口的模式的选项，可通过放置在 <code>.modal-dialog</code> 上的修饰符类获得。</p>
          <table class="table">
            <thead>
              <tr>
                <th>Class</th>
                <th>可用性</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><code>.modal-fullscreen</code></td>
                <td>一直</td>
              </tr>
              <tr>
                <td><code>.modal-fullscreen-sm-down</code></td>
                <td><code>576px</code> 以下</td>
              </tr>
              <tr>
                <td><code>.modal-fullscreen-md-down</code></td>
                <td><code>768px</code> 以下</td>
              </tr>
              <tr>
                <td><code>.modal-fullscreen-lg-down</code></td>
                <td><code>992px</code> 以下</td>
              </tr>
              <tr>
                <td><code>.modal-fullscreen-xl-down</code></td>
                <td><code>1200px</code> 以下</td>
              </tr>
              <tr>
                <td><code>.modal-fullscreen-xxl-down</code></td>
                <td><code>1400px</code> 以下</td>
              </tr>
            </tbody>
          </table>
          <div class="border-example">
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreen">全屏</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenSm">sm以下全屏</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenMd">md以下全屏</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenLg">lg以下全屏</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenXl">xl以下全屏</button>
            <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#exampleModalFullscreenXxl">xxl以下全屏</button>
          </div>
          <pre>&lt;!-- 全屏模态框 --&gt;
&lt;div class="modal-dialog modal-fullscreen-sm-down"&gt;
  ...
&lt;/div&gt;</pre>
          
          <div class="modal fade" id="exampleModalFullscreen" tabindex="-1" aria-labelledby="exampleModalFullscreenLabel" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalFullscreenLabel">全屏模态框</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
              </div>
            </div>
          </div>
          <div class="modal fade" id="exampleModalFullscreenSm" tabindex="-1" aria-labelledby="exampleModalFullscreenSmLabel" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen-sm-down">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalFullscreenSmLabel">sm以下全屏</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
              </div>
            </div>
          </div>
          <div class="modal fade" id="exampleModalFullscreenMd" tabindex="-1" aria-labelledby="exampleModalFullscreenMdLabel" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen-md-down">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalFullscreenMdLabel">md以下全屏</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
              </div>
            </div>
          </div>
          <div class="modal fade" id="exampleModalFullscreenLg" tabindex="-1" aria-labelledby="exampleModalFullscreenLgLabel" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen-lg-down">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalFullscreenLgLabel">lg以下全屏</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
              </div>
            </div>
          </div>
          <div class="modal fade" id="exampleModalFullscreenXl" tabindex="-1" aria-labelledby="exampleModalFullscreenXlLabel" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen-xl-down">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalFullscreenXlLabel">xl以下全屏</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
              </div>
            </div>
          </div>
          <div class="modal fade" id="exampleModalFullscreenXxl" tabindex="-1" aria-labelledby="exampleModalFullscreenXxlLabel" aria-hidden="true">
            <div class="modal-dialog modal-fullscreen-xxl-down">
              <div class="modal-content">
                <div class="modal-header">
                  <h6 class="modal-title" id="exampleModalFullscreenXxlLabel">xxl以下全屏</h6>
                  <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                  ...
                </div>
                <div class="modal-footer">
                  <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">关闭</button>
                </div>
              </div>
            </div>
          </div>
          <h5>用法</h5>
          <p>模态插件通过数据属性或 JavaScript 按需切换隐藏内容。 它还覆盖默认滚动行为并生成一个 <code>.modal-backdrop</code> 以提供一个单击区域，以便在单击模态框外时关闭显示的模态框。</p>
          <h6>通过数据属性</h6>
          <strong>Toggle</strong>
          <p>无需编写 JavaScript 即可激活模式。 在控制器元素（如按钮）上设置 <code>data-bs-toggle="modal"</code> 以及 <code>data-bs-target="#foo"</code> 或 < code>href=&quot;#foo&quot;</code> 以指定要切换的模式。</p>
          <pre>&lt;button type="button" data-bs-toggle="modal" data-bs-target="#myModal"&gt;Launch modal&lt;/button&gt;</pre>

          <strong>Dismiss</strong>
          <p>可以通过 <strong>模态</strong> 按钮上的 <code>data</code> 属性实现解除，如下所示：</p>
          <pre>&lt;button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"&gt;&lt;/button&gt;</pre>
          
          <p>或使用 <code>data-bs-target</code> 在 <strong>模态框外</strong> 的按钮上，如下所示：</p>
          <pre>&lt;button type="button" class="btn-close" data-bs-dismiss="modal" data-bs-target="#my-modal" aria-label="Close"&gt;&lt;/button&gt;</pre>
          
          <div class="callout callout-warning mb-3">虽然支持解除模态的两种方式，但请记住，从模态外部解除与 <a href="https://www.w3.org/TR/wai-aria-practices-1.1/#dialog_modal" target="_blank">WAI-ARIA 模式对话框设计模式</a>。这样做需要您自担风险。</div>

          <h6>通过 JavaScript</h6>
          <p>用一行 JavaScript 创建一个模态框：</p>
          <pre>var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)</pre>
          
          <h6>选项</h6>
          <p>选项可以通过数据属性或 JavaScript 传递。 对于数据属性，将选项名称附加到 <code>data-bs-</code>，如 <code>data-bs-backdrop=""</code>。</p>
          <table class="table">
            <thead>
              <tr>
                <th style="width: 100px;">姓名</th>
                <th style="width: 50px;">类型</th>
                <th style="width: 50px;">默认</th>
                <th>描述</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><code>backdrop</code></td>
                <td>boolean or the string <code>'static'</code></td>
                <td><code>true</code></td>
                <td>包括一个模态背景元素。 或者，为在单击时不关闭模式的背景指定 <code>static</code>。</td>
              </tr>
              <tr>
                <td><code>keyboard</code></td>
                <td>boolean</td>
                <td><code>true</code></td>
                <td>按下退出键时关闭模态</td>
              </tr>
              <tr>
                <td><code>focus</code></td>
                <td>boolean</td>
                <td><code>true</code></td>
                <td>初始化时将焦点放在模式上。</td>
              </tr>
            </tbody>
          </table>
          <h6>方法</h6>
          <div class="callout callout-danger mb-3">
            <strong>异步方法和转换</strong>
            <p>所有 API 方法都是<strong>异步</strong>并启动<strong>transition</strong>。 它们会在过渡开始后但<strong>在过渡结束之前</strong>返回给调用者。 此外，<strong>转换组件上的方法调用将被忽略</strong>。</p>
          </div>

          <strong>传递选项</strong>
          <p>将您的内容激活为模式。 接受可选选项<code>object</code>。</p>
          <pre>var myModal = new bootstrap.Modal(document.getElementById('myModal'), {
  keyboard: false
})</pre>
          
          <strong>toggle</strong>
          <p>手动切换模式。 <strong>在模态框实际显示或隐藏之前返回调用者</strong>（即在 <code>shown.bs.modal</code> 或 <code>hidden.bs.modal</code> 事件之前 发生）。</p>
          <pre>myModal.toggle()</pre>
          
          <strong>show</strong>
          <p>手动打开一个模态框。 <strong>在模态框实际显示之前返回调用者</strong>（即在 <code>shown.bs.modal</code> 事件发生之前）。</p>
          <pre>myModal.show()</pre>
          
          <p>此外，您可以将 DOM 元素作为可在模式事件中接收的参数传递（作为 <code>relatedTarget</code> 属性）。</p>
          <pre>var modalToggle = document.getElementById('toggleMyModal') // relatedTarget
myModal.show(modalToggle)</pre>
          
          <strong>hide</strong>
          <p>手动隐藏模态框。 <strong>在模态框实际隐藏之前返回调用者</strong>（即在 <code>hidden.bs.modal</code> 事件发生之前）。</p>
          <pre>myModal.hide()</pre>
          
          <strong>handleUpdate</strong>
          <p>如果模态框在打开时的高度发生变化（即出现滚动条时），请手动重新调整模态框的位置。</p>
          <pre>myModal.handleUpdate()</pre>
          
          <strong>dispose</strong>
          <p>销毁元素的模态。（删除 DOM 元素上存储的数据）</p>
          <pre>myModal.dispose()</pre>
          
          <strong>getInstance</strong>
          <p><em>Static</em> 方法，允许您获取与 DOM 元素关联的模态实例。</p>
          <pre>var myModalEl = document.getElementById('myModal')
var modal = bootstrap.Modal.getInstance(myModalEl) // Returns a Bootstrap modal instance</pre>
          
          <strong>getOrCreateInstance</strong>
          <p><em>Static</em> 方法，该方法允许您获取与 DOM 元素关联的模式实例，或者在未初始化的情况下创建一个新实例。</p>
          <pre>var myModalEl = document.querySelector('#myModal')
var modal = bootstrap.Modal.getOrCreateInstance(myModalEl) // Returns a Bootstrap modal instance</pre>
          
          <h6>事件</h6>
          <p>Bootstrap 的模态类公开了一些用于连接模态功能的事件。 所有模态事件都在模态本身触发（即在 <code>&lt;div class="modal"&gt;</code> 处）。</p>
          <table class="table">
            <thead>
              <tr>
                <th style="width: 150px;">事件类型</th>
                <th>描述</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td><code>show.bs.modal</code></td>
                <td>此事件在调用 <code>show</code> 实例方法时立即触发。 如果由单击引起，则单击的元素可用作事件的 <code>relatedTarget</code> 属性。</td>
              </tr>
              <tr>
                <td><code>shown.bs.modal</code></td>
                <td>当模式对用户可见时触发此事件（将等待 CSS 转换完成）。 如果由单击引起，则单击的元素可用作事件的 <code>relatedTarget</code> 属性。</td>
              </tr>
              <tr>
                <td><code>hide.bs.modal</code></td>
                <td>当调用 <code>hide</code> 实例方法时，会立即触发此事件。</td>
              </tr>
              <tr>
                <td><code>hidden.bs.modal</code></td>
                <td>当模态对用户隐藏完成时会触发此事件（将等待 CSS 转换完成）。</td>
              </tr>
              <tr>
                <td><code>hidePrevented.bs.modal</code></td>
                <td>当显示模式时触发此事件，其背景为 <code>static</code> 并且使用键盘选项或 <code>data-bs-keyboard</code> 执行模式外的单击或退出键按下设置为 <code>false</code>。</td>
              </tr>
            </tbody>
          </table>
          <pre>var myModalEl = document.getElementById('myModal')
myModalEl.addEventListener('hidden.bs.modal', function (event) {
  // do something...
})</pre>
          
        </div>
      </div>
    </div>
        
  </div>
  
</div>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/popper.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/main.min.js"></script>
<script type="text/javascript">
/* 演示示例的一些代码 */
var exampleModal = document.getElementById('exampleModal')
exampleModal.addEventListener('show.bs.modal', function (event) {
    var button = event.relatedTarget
    var recipient = button.getAttribute('data-bs-whatever')
    var modalTitle = exampleModal.querySelector('.modal-title')
    var modalBodyInput = exampleModal.querySelector('.modal-body input')

    modalTitle.textContent = '给 ' + recipient + '的新消息'
    modalBodyInput.value = recipient
})
</script>
</body>
</html>